<?php

/**
 * ValTarjeton form base class.
 *
 * @method ValTarjeton getObject() Returns the current form's model object
 *
 * @package    level
 * @subpackage form
 * @author     Carlos Fernández
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseValTarjetonForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'numero'           => new sfWidgetFormInputText(),
      'os'               => new sfWidgetFormInputText(),
      'esm'              => new sfWidgetFormInputText(),
      'cat'              => new sfWidgetFormInputText(),
      'fecha'            => new sfWidgetFormDateTime(),
      'falla'            => new sfWidgetFormInputText(),
      'ppu'              => new sfWidgetFormInputText(),
      'bus'              => new sfWidgetFormInputText(),
      'op'               => new sfWidgetFormInputText(),
      'tecnico'          => new sfWidgetFormInputText(),
      'requerimiento_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ValRequerimiento'), 'add_empty' => false)),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'numero'           => new sfValidatorInteger(array('required' => false)),
      'os'               => new sfValidatorInteger(array('required' => false)),
      'esm'              => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'cat'              => new sfValidatorInteger(array('required' => false)),
      'fecha'            => new sfValidatorDateTime(array('required' => false)),
      'falla'            => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'ppu'              => new sfValidatorString(array('max_length' => 6, 'required' => false)),
      'bus'              => new sfValidatorInteger(array('required' => false)),
      'op'               => new sfValidatorInteger(array('required' => false)),
      'tecnico'          => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'requerimiento_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ValRequerimiento'))),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('val_tarjeton[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ValTarjeton';
  }

}
